package com.fr.dialog.core;

import java.io.File;
import java.util.Hashtable;
import javax.swing.Icon;
import javax.swing.filechooser.FileView;

public class ChooseFileView extends FileView
{
  private Hashtable icons = new Hashtable(5);
  private Hashtable fileDescriptions = new Hashtable(5);
  private Hashtable typeDescriptions = new Hashtable(5);
  private File[] rootFileArray = null;

  public boolean isRootFile(File paramFile)
  {
    if ((paramFile == null) || (this.rootFileArray == null))
      return false;
    for (int i = 0; i < this.rootFileArray.length; ++i)
      if (paramFile.equals(this.rootFileArray[i]))
        return true;
    return false;
  }

  public String getName(File paramFile)
  {
    return null;
  }

  public void putDescription(File paramFile, String paramString)
  {
    this.fileDescriptions.put(paramString, paramFile);
  }

  public String getDescription(File paramFile)
  {
    return ((String)this.fileDescriptions.get(paramFile));
  }

  public void putTypeDescription(String paramString1, String paramString2)
  {
    this.typeDescriptions.put(paramString2, paramString1);
  }

  public void putTypeDescription(File paramFile, String paramString)
  {
    putTypeDescription(getExtension(paramFile), paramString);
  }

  public String getTypeDescription(File paramFile)
  {
    return ((String)this.typeDescriptions.get(getExtension(paramFile)));
  }

  public String getExtension(File paramFile)
  {
    String str = paramFile.getName();
    if (str != null)
    {
      int i = str.lastIndexOf(46);
      if (i < 0)
        return null;
      return str.substring(i + 1).toLowerCase();
    }
    return null;
  }

  public void putIcon(String paramString, Icon paramIcon)
  {
    this.icons.put(paramString, paramIcon);
  }

  public Icon getIcon(File paramFile)
  {
    Icon localIcon = null;
    String str = getExtension(paramFile);
    if (str != null)
      localIcon = (Icon)this.icons.get(str);
    if (localIcon == null)
      return super.getIcon(paramFile);
    return localIcon;
  }

  public Boolean isHidden(File paramFile)
  {
    String str = paramFile.getName();
    if ((str != null) && (!(str.equals(""))) && (str.charAt(0) == '.'))
      return Boolean.TRUE;
    return Boolean.FALSE;
  }

  public Boolean isTraversable(File paramFile)
  {
    return null;
  }
}